From: Roger Pau Monne Date: Tue, 26 Apr 2016 10:07:51 +0000 (+0200) Subject: oxenstored: fix error when shifting negative value X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~1229 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/%22bookmarks://%22Dat/%22http:/www.example.com/cgi/%22https:/%22bookmarks:/%22Dat?a=commitdiff_plain;h=92afa655e7b60a3c4d00fe1c7193e79fa4b901ad;p=xen.git oxenstored: fix error when shifting negative value By explicitly casting it to unsigned. Reasoning on why this is needed, provided by Andrew Cooper: "Ocaml stores integers shifted left by one, and with the bottom bit set. Values with the bottom bit clear are pointers into the GC'd heap. Values with the bottom bit set are integers, and need to be shifted by 1 bit to have calculations performed." Signed-off-by: Roger Pau Monné Reviewed-by: Andrew Cooper Acked-by: Wei Liu Release-acked-by: Wei Liu --- diff --git a/tools/ocaml/xenstored/systemd_stubs.c b/tools/ocaml/xenstored/systemd_stubs.c index 1bd5deaf53..a78a72b75c 100644 --- a/tools/ocaml/xenstored/systemd_stubs.c +++ b/tools/ocaml/xenstored/systemd_stubs.c @@ -124,7 +124,7 @@ CAMLprim value ocaml_sd_listen_fds(value connect_to) CAMLparam1(connect_to); CAMLlocal1(sock_ret); - sock_ret = Val_int(-1); + sock_ret = Val_int(-1U); CAMLreturn(sock_ret); } @@ -144,7 +144,7 @@ CAMLprim value ocaml_sd_notify_ready(value ignore) CAMLparam1(ignore); CAMLlocal1(ret); - ret = Val_int(-1); + ret = Val_int(-1U); CAMLreturn(ret); }